home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 284_01 / porting.doc < prev    next >
Text File  |  1989-03-11  |  6KB  |  118 lines

  1. Porting Portable 8080 system to other systems
  2.  
  3.  
  4. Introduction
  5.  
  6.     Although this program was carefully created considering the 
  7.     portability, the porting of the program requires more than 
  8.     recompiling the program.
  9.     In this documentation, topics important to the porting are 
  10.     explained.
  11.     
  12. 1. The nature of compilers
  13.  
  14.     The characteristics of a C compiler changes as the system changes.
  15.     Particularly, the difference of data type and expression between
  16.     two systems is very significant.
  17.     You need to make changes in the program with taking special care 
  18.         because the program is very sensitive with the data expression on
  19.     memory. The include file, "compile.h" is prepared for this purpose.
  20.     You need to appropriately set macros defined in this file.
  21.  
  22.     In multi-byte integers, when a least significant byte locates first 
  23.     in memory, it is called Little Indian, when a most significant byte
  24.     locates first, it is called Big Indian.
  25.     Intel micro processors and DEC VAX-11 use a Little Indian scheme
  26.     whereas Motolora processors and IBM370 architecture use Big Indian
  27.     scheme.
  28.     There are macros, LITTLEINDEAN and BIGINDEAN in compile.h.
  29.     You need to preset these for your machine.
  30.  
  31.     In compile.h, there are four other definitions that define
  32.     basic data type: BYTE(1 byte), WORD(2 bytes), BOOL(1 bit) and EXTRA
  33.     (3 bytes)(all are unsigned integer).
  34.     Although the size of BYTE and WORD must be 1 byte and 2 bytes 
  35.     respectively, the size of BOOL and EXTRA can be longer, so please 
  36.     select fast access one.
  37.  
  38.     Besides the points discussed above, it is assumed that memory is 
  39.     addressed by byte unit (1 byte represents 8 bits), a number is 
  40.     expressed in two's complement .. etc.
  41.     Although this assumption doesn't cause any problems, the situation
  42.     could be changed in the future.
  43.  
  44. 2. Low-level Input/Output (BIOS)
  45.  
  46.     In portable 8080, a module corresponding to BIOS for CP/M is written 
  47.     in C.
  48.     You need to create this part suitable for your host operating system
  49.     because it plays an important role as interface between CP/M 
  50.     and the host operating system.
  51.  
  52.     The file, "bios.c" performs four things: simulation of direct
  53.     I/O, access to a virtual disk, access to a physical disk, character
  54.     I/O. In the current version, the program is created based on the 
  55.     assumption
  56.     of the combination of MS-DOS and NEC PC-9801. Turbo C special features
  57.     are used to call ROM-BIOS in NEC.
  58.  
  59.     Direct I/O access simulates 8080 instructions IN and OUT and 
  60.     has nothing to do with CP/M. When you create functions that simulate
  61.     devices attached to an I/O port, you can execute special programs.
  62.     This module includes an IoMap table, in which you can set a validity of
  63.     each port for all 256 ports. Currently, all ports are set as invalid.
  64.     When you set a macro INOUT in config.h to 1, this feature is available.
  65.  
  66.     Access to virtual disk simulates a floppy disk drive under virtual 
  67.     CP/M. In the virtual CP/M, a floppy disk under CP/M becomes a file.
  68.     The virtual CP/M also allows you to access up to 8 disk drives 
  69.     assigning each disk drive to a file in the host operating system.
  70.     The contents of each file is the same as an 8 inch single sided
  71.     single density when it is dumped from the first sector of the disk.
  72.     That part is written using only UNIX standard functions. Therefore,
  73.     would be no trouble to port to the other operating system.
  74.  
  75.     Access to a physical disk allows you to assign one of  eight virtual
  76.     disk drives to a physical eight inch disk drive.
  77.     This feature is intended to transfer files between other real CP/Ms.
  78.     This part of the program is hardware dependent because it uses
  79.     a sector-address scheme.
  80.     In the current version, it is set in such a way that it calls ROM-BIOS
  81.     in NEC PC-9801. When using other hardware, the program needs to be
  82.     rewritten.
  83.  
  84.     The character I/O part performs CP/M console, printer output, and
  85.     auxiliary input and output. They make use of system calls 
  86.     in the host operating system. In the current MS-DOS version, they are
  87.     mapped to four file handles: 0, 1, 3 and 4.
  88.     As for the console input, you have to handle a raw character input
  89.     , that is, no echo and no buffering, and control C character under
  90.     MSDOS, moreover, newline character under UNIX.
  91.  
  92. 3. Command Line Interface and Boot File
  93.  
  94.     To start portable 8080, you need to give program options in the command
  95.     line. Although the current version distinguishes lower-case letters from
  96.     upper-case letters in the option characters, some systems don't.
  97.     In that case, you need to make a change to the program so that 
  98.     all lower-case letters are converted to upper-case letters (The same
  99.     is true for console output. CP/M application programs are designed in 
  100.     such a way that it can run with input of upper-case letters.)
  101.  
  102.     Some options that require a file name have a default file name.
  103.     You need to use a default file name suitable for the host operating
  104.     system. All default filenames are defined in "mon.h".
  105.  
  106.     Among default files, there is a boot file. This is the file that
  107.     includes a program read into 8080 when the portable 8080 starts.
  108.     In the current version, the boot program is recorded in the Intel
  109.     hexa format. If there is a better format for the host operating 
  110.     system, you might make a change. The boot file is read every time
  111.     CP/M does a warm boot. When you have a slow file access system or
  112.     small CPU, you need to make a change such as changing a format of the 
  113.     boot file, which will be processed faster or modifying the program
  114.     so that it will record a boot image in the first place and it will 
  115.     not have to read the boot file from the second time.
  116.  
  117.  
  118.